Add a new documentation page for WithContainerFiles and PublishWithContainerFiles#400
Add a new documentation page for WithContainerFiles and PublishWithContainerFiles#400
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new AppHost documentation page that explains Aspire’s container file APIs (WithContainerFiles and PublishWithContainerFiles) and links it into the left-nav sidebar.
Changes:
- New
app-host/container-filesMDX page documenting development-time file injection and publish-time file copying. - Added “Container files” entry to the AppHost section in the docs sidebar.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| src/frontend/src/content/docs/app-host/container-files.mdx | New documentation page describing container file APIs, permissions/ownership, and examples. |
| src/frontend/config/sidebar/docs.topics.ts | Adds the new page to the AppHost sidebar navigation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ```csharp title="AppHost.cs" | ||
| new ContainerDirectory | ||
| { | ||
| Name = "assets", | ||
| Entries = ContainerDirectory.GetFileSystemItemsFromPath( | ||
| "/path/to/assets", | ||
| searchOptions: SearchOption.AllDirectories) | ||
| } | ||
| ``` |
There was a problem hiding this comment.
This snippet constructs a ContainerDirectory as a standalone expression without a semicolon/assignment, so it’s not valid C# as-is. Add a semicolon or show the object initializer in a containing statement to keep examples copy/paste runnable.
| ```csharp title="AppHost.cs" | ||
| // File with inline contents | ||
| new ContainerFile | ||
| { | ||
| Name = "config.yaml", | ||
| Contents = "key: value" | ||
| } | ||
|
|
||
| // File sourced from the host file system | ||
| new ContainerFile | ||
| { | ||
| Name = "data.csv", | ||
| SourcePath = "/path/to/data.csv" | ||
| } | ||
| ``` |
There was a problem hiding this comment.
This C# snippet shows standalone new ContainerFile { ... } expressions without terminating semicolons or assigning them to variables/collections, so it won’t compile as written. Consider adding semicolons or wrapping the examples in a containing statement (e.g., an array/collection initializer) to make the snippet copy/paste runnable.
| ```csharp title="AppHost.cs" | ||
| new ContainerFile | ||
| { | ||
| Name = "optional-config.json", | ||
| Contents = "{}", | ||
| ContinueOnError = true | ||
| } | ||
| ``` |
There was a problem hiding this comment.
This ContinueOnError example is a standalone object creation expression without a semicolon/assignment, so it won’t compile if copied directly. Add a semicolon or show it in a context (e.g., assigned to a variable or included in an Entries/collection expression).
| ```csharp title="AppHost.cs" | ||
| new ContainerDirectory | ||
| { | ||
| Name = "certs", | ||
| Entries = [ | ||
| new ContainerFile | ||
| { | ||
| Name = "ca.pem", | ||
| SourcePath = "/path/to/ca.pem" | ||
| }, | ||
| new ContainerDirectory | ||
| { | ||
| Name = "private", | ||
| Entries = [ | ||
| new ContainerFile | ||
| { | ||
| Name = "server.key", | ||
| SourcePath = "/path/to/server.key", | ||
| Mode = UnixFileMode.UserRead | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ``` |
There was a problem hiding this comment.
This ContainerDirectory example is presented as a top-level expression without a trailing semicolon or assignment, which makes the snippet invalid C# when copied. Add a semicolon or demonstrate it as part of a WithContainerFiles(..., [ ... ]) call.
Fixes #343